package weekMatch.one_348;

public class LeeCode_02 {
    public static void main(String[] args) {

    }
    private static int semiOrderedPermutation(int[] nums) {
        int n = nums.length;
        int i1 = 0, in = 0;
        for (int i = 0; i < n; i++) {
            if (nums[i] == 1){
                i1 = i;
            }
            if (nums[i] == n){
                in = i;
            }
        }
        if (i1 < in){
            return i1 + n - 1 - in;
        }else {
            return i1 + n - 1 - in - 1;
        }
    }
}
